import React, { Component } from 'react'
import styles from "../assets/styles/model.module.css"

export default class Model extends Component {
    render() {
        const { visible, title, closeModel } = this.props
        if (visible) {
            return (
                // 整个遮罩层
                <div className={styles.modelOption}>
                    {/* 弹框要显示部分 */}
                    <div className={styles.modelContent}>
                        <h3>{title}</h3>
                        {/* 存放布局代码 */}
                        <div>
                            {this.props.children}
                        </div>
                        <button onClick={() => closeModel(false)}>关闭</button>
                    </div>
                </div>
            )
        } else {
            return null
        }

    }
}
